#coding=utf-8
import importlib

class AssertRegister(object):

    @classmethod
    def register(cls, module_class, module_name,method):

        if hasattr(module_class, module_name):
            handler_class = getattr(module_class, module_name)
            invert_op = getattr(handler_class, method, None)
            if callable(invert_op):
                return handler_class
            else:
                return

    
if __name__=="__main__":
#     moudel_class=importlib.import_module("process_assert.TestAssert")
#     aa= AssertRegister.register(moudel_class,"TestAssert")("a","b")
#     aa.test()
    moudel_class=importlib.import_module("handle_request_header.TestHandle")
    aa= AssertRegister.register(moudel_class,"TestHandle","foo")()
    aa.foo()
